﻿using System;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TeamSystem.Data.UnitTesting;
using Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions;

namespace Acms.SqlStoredProcedureTests
{
    [TestClass()]
    public class Site_GetByRootUrl : DatabaseTestClass
    {

        public Site_GetByRootUrl()
        {
            InitializeComponent();
        }

        [TestInitialize()]
        public void TestInitialize()
        {
            base.InitializeTest();
        }
        [TestCleanup()]
        public void TestCleanup()
        {
            base.CleanupTest();
        }

        #region Designer support code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.DatabaseTestAction ExecuteTest_TestAction;
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Site_GetByRootUrl));
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.RowCountCondition ExecuteCount;
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition ExecuteId;
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition ExecuteName;
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition ExecuteRootUrl;
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.DatabaseTestAction ExcludeDeleted_TestAction;
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.EmptyResultSetCondition ExcluseDeleteNoResult;
            Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition ExcludeDeleteRowCount;
            this.ExecuteTestData = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.DatabaseTestActions();
            this.ExcludeDeletedData = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.DatabaseTestActions();
            ExecuteTest_TestAction = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.DatabaseTestAction();
            ExecuteCount = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.RowCountCondition();
            ExecuteId = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition();
            ExecuteName = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition();
            ExecuteRootUrl = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition();
            ExcludeDeleted_TestAction = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.DatabaseTestAction();
            ExcluseDeleteNoResult = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.EmptyResultSetCondition();
            ExcludeDeleteRowCount = new Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions.ScalarValueCondition();
            // 
            // ExecuteTestData
            // 
            this.ExecuteTestData.PosttestAction = null;
            this.ExecuteTestData.PretestAction = null;
            this.ExecuteTestData.TestAction = ExecuteTest_TestAction;
            // 
            // ExecuteTest_TestAction
            // 
            ExecuteTest_TestAction.Conditions.Add(ExecuteCount);
            ExecuteTest_TestAction.Conditions.Add(ExecuteId);
            ExecuteTest_TestAction.Conditions.Add(ExecuteName);
            ExecuteTest_TestAction.Conditions.Add(ExecuteRootUrl);
            resources.ApplyResources(ExecuteTest_TestAction, "ExecuteTest_TestAction");
            // 
            // ExecuteCount
            // 
            ExecuteCount.Enabled = true;
            ExecuteCount.Name = "ExecuteCount";
            ExecuteCount.ResultSet = 1;
            ExecuteCount.RowCount = 1;
            // 
            // ExecuteId
            // 
            ExecuteId.ColumnNumber = 1;
            ExecuteId.Enabled = true;
            ExecuteId.ExpectedValue = "0";
            ExecuteId.Name = "ExecuteId";
            ExecuteId.NullExpected = false;
            ExecuteId.ResultSet = 1;
            ExecuteId.RowNumber = 1;
            // 
            // ExecuteName
            // 
            ExecuteName.ColumnNumber = 2;
            ExecuteName.Enabled = true;
            ExecuteName.ExpectedValue = "Finale34";
            ExecuteName.Name = "ExecuteName";
            ExecuteName.NullExpected = false;
            ExecuteName.ResultSet = 1;
            ExecuteName.RowNumber = 1;
            // 
            // ExecuteRootUrl
            // 
            ExecuteRootUrl.ColumnNumber = 3;
            ExecuteRootUrl.Enabled = true;
            ExecuteRootUrl.ExpectedValue = "localhost/TestUrl34";
            ExecuteRootUrl.Name = "ExecuteRootUrl";
            ExecuteRootUrl.NullExpected = false;
            ExecuteRootUrl.ResultSet = 1;
            ExecuteRootUrl.RowNumber = 1;
            // 
            // ExcludeDeletedData
            // 
            this.ExcludeDeletedData.PosttestAction = null;
            this.ExcludeDeletedData.PretestAction = null;
            this.ExcludeDeletedData.TestAction = ExcludeDeleted_TestAction;
            // 
            // ExcludeDeleted_TestAction
            // 
            ExcludeDeleted_TestAction.Conditions.Add(ExcludeDeleteRowCount);
            ExcludeDeleted_TestAction.Conditions.Add(ExcluseDeleteNoResult);
            resources.ApplyResources(ExcludeDeleted_TestAction, "ExcludeDeleted_TestAction");
            // 
            // ExcluseDeleteNoResult
            // 
            ExcluseDeleteNoResult.Enabled = true;
            ExcluseDeleteNoResult.Name = "ExcluseDeleteNoResult";
            ExcluseDeleteNoResult.ResultSet = 2;
            // 
            // ExcludeDeleteRowCount
            // 
            ExcludeDeleteRowCount.ColumnNumber = 1;
            ExcludeDeleteRowCount.Enabled = true;
            ExcludeDeleteRowCount.ExpectedValue = "1";
            ExcludeDeleteRowCount.Name = "ExcludeDeleteRowCount";
            ExcludeDeleteRowCount.NullExpected = false;
            ExcludeDeleteRowCount.ResultSet = 1;
            ExcludeDeleteRowCount.RowNumber = 1;
        }

        #endregion


        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        #endregion


        [TestMethod()]
        public void ExecuteTest()
        {
            DatabaseTestActions testActions = this.ExecuteTestData;
            // Execute the pre-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PretestAction != null), "Executing pre-test script...");
            ExecutionResult[] pretestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PretestAction);
            // Execute the test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.TestAction != null), "Executing test script...");
            ExecutionResult[] testResults = TestService.Execute(this.ExecutionContext, this.PrivilegedContext, testActions.TestAction);
            // Execute the post-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PosttestAction != null), "Executing post-test script...");
            ExecutionResult[] posttestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PosttestAction);
        }
        [TestMethod()]
        public void ExcludeDeleted()
        {
            DatabaseTestActions testActions = this.ExcludeDeletedData;
            // Execute the pre-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PretestAction != null), "Executing pre-test script...");
            ExecutionResult[] pretestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PretestAction);
            // Execute the test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.TestAction != null), "Executing test script...");
            ExecutionResult[] testResults = TestService.Execute(this.ExecutionContext, this.PrivilegedContext, testActions.TestAction);
            // Execute the post-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PosttestAction != null), "Executing post-test script...");
            ExecutionResult[] posttestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PosttestAction);
        }
        private DatabaseTestActions ExecuteTestData;
        private DatabaseTestActions ExcludeDeletedData;
    }
}
